//package com.dam.config.feign;
//
//
//import feign.RequestInterceptor;
//import feign.RequestTemplate;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.context.request.ServletRequestAttributes;
//
//import javax.servlet.http.HttpServletRequest;
//
///**
// * 调用远程服务的时候传递token过去
// */
//@Configuration
//public class FeignConfig implements RequestInterceptor {
//
//    @Override
//    public void apply(RequestTemplate requestTemplate) {
//        if (RequestContextHolder.getRequestAttributes()!=null){
//            //拿到老请求的请求头
//            ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
//            HttpServletRequest request = attributes.getRequest();
//            //设置到新的请求头中
//            requestTemplate.header("token", request.getHeader("token"));
//        }
//
//    }
//
//}
